<%@ page import="util.JDBC" %>
<%@ page import="util.JSON" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //初始化
    response.setCharacterEncoding("utf-8");
    response.setContentType("text/html;charset=utf-8");
    String userId="";
    try{
        userId=session.getAttribute("userId").toString();
    }catch (Exception ex){
        response.sendRedirect("login.jsp");
    }
    if(!userId.equals("1")){
        response.sendRedirect("login.jsp");
    }
    //处理请求
    String courseId=request.getParameter("courseId");
    String sql="delete from course where id='"+courseId+"'";
    JDBC.connectionTest();
    JDBC.executeUpdate(sql);
    System.out.println("删除id为"+courseId+"的课程成功！");
    JSON json=new JSON("status","success");
    json.put("message","删除课程成功！");
    out.print(json.getJson());
%>